package cz.cvut.fel.nur.rcp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;

public class Nastaveni extends Activity implements OnClickListener {

	GlobalClass appState;

	Button menuUp, menuDown, alarm, programme, history;

	ImageView pantry, recipes, list, options, home;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.nastaveni);
		super.onCreate(savedInstanceState);

		appState = ((GlobalClass) getApplicationContext());

		alarm = (Button) findViewById(R.id.alarmButton);
		alarm.setOnClickListener((android.view.View.OnClickListener) this);
		programme = (Button) findViewById(R.id.programmeButton);
		programme.setOnClickListener((android.view.View.OnClickListener) this);
		history = (Button) findViewById(R.id.historyButton);
		history.setOnClickListener((android.view.View.OnClickListener) this);

		menuDown = (Button) findViewById(R.id.menuDownButton);
		menuDown.setOnClickListener((android.view.View.OnClickListener) this);
		menuUp = (Button) findViewById(R.id.menuUpButton);
		menuUp.setOnClickListener((android.view.View.OnClickListener) this);

		pantry = (ImageView) findViewById(R.id.pantryButton);
		pantry.setOnClickListener((android.view.View.OnClickListener) this);
		recipes = (ImageView) findViewById(R.id.recipesButton);
		recipes.setOnClickListener((android.view.View.OnClickListener) this);
		list = (ImageView) findViewById(R.id.listButton);
		list.setOnClickListener((android.view.View.OnClickListener) this);
		options = (ImageView) findViewById(R.id.optionsButton);
		options.setOnClickListener((android.view.View.OnClickListener) this);
		home = (ImageView) findViewById(R.id.homeButton);
		home.setOnClickListener((android.view.View.OnClickListener) this);

		// visibility
		menuDown.setVisibility(View.GONE); // 0 is visible
		pantry.setVisibility(View.GONE);
		recipes.setVisibility(View.GONE);
		list.setVisibility(View.GONE);
		options.setVisibility(View.GONE);
		home.setVisibility(View.GONE);

	}

	public void onClick(View v) {
		if (v.getId() == R.id.menuDownButton) {
			menuDown.setVisibility(View.GONE);
			pantry.setVisibility(View.GONE);
			recipes.setVisibility(View.GONE);
			list.setVisibility(View.GONE);
			options.setVisibility(View.GONE);
			home.setVisibility(View.GONE);
		}
		if (v.getId() == R.id.menuUpButton) {
			menuDown.setVisibility(0);
			pantry.setVisibility(0);
			recipes.setVisibility(0);
			list.setVisibility(0);
			options.setVisibility(0);
			home.setVisibility(0);
		}

		/* obrazky */
		if (v.getId() == R.id.pantryButton) {
			startActivity(new Intent(this, Spiz.class));
		}
		if (v.getId() == R.id.recipesButton) {
			startActivity(new Intent(this, Recepty.class));
		}
		if (v.getId() == R.id.listButton) {
			startActivity(new Intent(this, NakupniSeznam.class));
		}
		if (v.getId() == R.id.optionsButton) {
			startActivity(new Intent(this, Nastaveni.class));
		}
		if (v.getId() == R.id.homeButton) {
			startActivity(new Intent(this, Main.class));
		}
		
		if (v.getId() == R.id.alarmButton) {
			startActivity(new Intent(this, NastaveniStrava.class));
		}
		if (v.getId() == R.id.historyButton) {
			startActivity(new Intent(this, NastaveniHistorie.class));
		}
	}

}
